home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 June: Reference Library / Dev.CD Jun 96 RL / Dev.CD Jun 96 RL.toast / Technical Documentation / develop / develop Issue 11 / develop Issue 11 code / MultiBuffer.sea / MultiBuffer / MultiBuffer Source / PlayFromSynth.c < prev    next >
MacBinary  |  1992-07-15  |  3.9 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
1% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Wed Jul 15 15:24:39 1992, modified Wed Jul 15 15:24:39 1992, creator 'MPS ', type ASCII, 3303 bytes "PlayFromSynth.c" , at 0xd67 428 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% dearkID deark: macbinary default
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0f 50 6c 61 79 46 72 | 6f 6d 53 79 6e 74 68 2e |..PlayFr|omSynth.|
|00000010| 63 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |c.......|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 0c e7 00 | 00 01 ac a6 8a 2b f7 a6 |........|.....+..|
|00000060| 8a 2b f7 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.+......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 a1 e0 00 00 |........|........|
|00000080| 2f 2f 0d 2f 2f 0d 2f 2f | 0d 2f 2f 09 09 09 54 68 |//.//.//|.//...Th|
|00000090| 65 20 46 6f 6c 6c 6f 77 | 69 6e 67 20 43 6f 64 65 |e Follow|ing Code|
|000000a0| 20 69 73 20 53 70 65 63 | 69 66 69 63 20 74 6f 20 | is Spec|ific to |
|000000b0| 50 6c 61 79 2d 66 72 6f | 6d 2d 57 61 76 65 20 74 |Play-fro|m-Wave t|
|000000c0| 79 70 65 20 6f 70 65 72 | 61 74 69 6f 6e 73 0d 2f |ype oper|ations./|
|000000d0| 2f 0d 2f 2f 0d 2f 2f 0d | 0d 23 70 72 61 67 6d 61 |/.//.//.|.#pragma|
|000000e0| 20 6c 6f 61 64 20 22 4d | 61 63 48 65 61 64 65 72 | load "M|acHeader|
|000000f0| 73 22 0d 0d 0d 23 69 66 | 6e 64 65 66 20 5f 5f 4d |s"...#if|ndef __M|
|00000100| 41 49 4e 49 4e 43 4c 55 | 44 45 53 5f 5f 0d 23 69 |AININCLU|DES__.#i|
|00000110| 6e 63 6c 75 64 65 20 22 | 4d 61 69 6e 41 70 70 2e |nclude "|MainApp.|
|00000120| 68 22 0d 23 65 6e 64 69 | 66 0d 0d 23 69 66 6e 64 |h".#endi|f..#ifnd|
|00000130| 65 66 09 5f 5f 44 4f 55 | 42 4c 45 42 55 46 46 45 |ef.__DOU|BLEBUFFE|
|00000140| 52 49 4e 43 4c 55 44 45 | 53 5f 5f 0d 23 69 6e 63 |RINCLUDE|S__.#inc|
|00000150| 6c 75 64 65 20 22 44 6f | 75 62 6c 65 42 75 66 66 |lude "Do|ubleBuff|
|00000160| 65 72 2e 68 22 0d 23 65 | 6e 64 69 66 0d 0d 65 78 |er.h".#e|ndif..ex|
|00000170| 74 65 72 6e 09 20 53 6e | 64 43 68 61 6e 6e 65 6c |tern. Sn|dChannel|
|00000180| 50 74 72 09 67 53 6e 64 | 43 68 61 6e 3b 0d 0d 2f |Ptr.gSnd|Chan;../|
|00000190| 2f 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |/~~~~~~~|~~~~~~~~|
|000001a0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000001b0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000001c0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000001d0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000001e0| 7e 0d 2f 2f 09 48 69 67 | 68 20 4c 65 76 65 6c 20 |~.//.Hig|h Level |
|000001f0| 72 6f 75 74 69 6e 65 20 | 74 68 61 74 20 70 6c 61 |routine |that pla|
|00000200| 79 73 20 61 20 77 61 76 | 65 20 66 6f 72 6d 2e 2e |ys a wav|e form..|
|00000210| 2e 0d 0d 76 6f 69 64 20 | 50 6c 61 79 57 61 76 65 |...void |PlayWave|
|00000220| 20 28 6c 6f 6e 67 20 64 | 75 72 72 61 74 69 6f 6e | (long d|urration|
|00000230| 2c 20 57 61 76 65 43 79 | 63 6c 65 50 74 72 20 74 |, WaveCy|clePtr t|
|00000240| 68 65 57 61 76 65 2c 20 | 50 74 72 20 2a 70 72 69 |heWave, |Ptr *pri|
|00000250| 76 61 74 65 44 61 74 61 | 29 0d 7b 0d 09 4f 53 45 |vateData|).{..OSE|
|00000260| 72 72 09 09 09 65 72 72 | 3b 0d 09 53 6f 75 6e 64 |rr...err|;..Sound|
|00000270| 48 65 61 64 65 72 09 09 | 74 68 65 48 65 61 64 65 |Header..|theHeade|
|00000280| 72 3b 0d 09 0d 09 2f 2f | 09 46 61 6b 65 20 61 20 |r;....//|.Fake a |
|00000290| 73 6f 75 6e 64 20 68 65 | 61 64 65 72 20 66 6f 72 |sound he|ader for|
|000002a0| 20 74 68 65 20 77 61 76 | 65 20 77 65 27 72 65 20 | the wav|e we're |
|000002b0| 67 6f 69 6e 67 20 74 6f | 20 70 6c 61 79 0d 09 74 |going to| play..t|
|000002c0| 68 65 48 65 61 64 65 72 | 2e 73 61 6d 70 6c 65 50 |heHeader|.sampleP|
|000002d0| 74 72 09 09 09 3d 20 6e | 69 6c 3b 0d 09 74 68 65 |tr...= n|il;..the|
|000002e0| 48 65 61 64 65 72 2e 6c | 65 6e 67 74 68 09 09 09 |Header.l|ength...|
|000002f0| 3d 20 6e 69 6c 3b 0d 09 | 74 68 65 48 65 61 64 65 |= nil;..|theHeade|
|00000300| 72 2e 73 61 6d 70 6c 65 | 52 61 74 65 09 09 3d 20 |r.sample|Rate..= |
|00000310| 28 46 69 78 65 64 29 20 | 30 78 35 36 65 65 38 62 |(Fixed) |0x56ee8b|
|00000320| 61 33 3b 09 09 09 09 09 | 2f 2f 20 32 32 6b 48 7a |a3;.....|// 22kHz|
|00000330| 20 63 6f 6e 73 74 61 6e | 74 0d 09 74 68 65 48 65 | constan|t..theHe|
|00000340| 61 64 65 72 2e 6c 6f 6f | 70 53 74 61 72 74 09 09 |ader.loo|pStart..|
|00000350| 09 3d 20 6e 69 6c 3b 0d | 09 74 68 65 48 65 61 64 |.= nil;.|.theHead|
|00000360| 65 72 2e 6c 6f 6f 70 45 | 6e 64 09 09 09 3d 20 6e |er.loopE|nd...= n|
|00000370| 69 6c 3b 0d 09 09 0d 09 | 65 72 72 20 3d 20 44 6f |il;.....|err = Do|
|00000380| 75 62 6c 65 42 75 66 66 | 65 72 28 67 53 6e 64 43 |ubleBuff|er(gSndC|
|00000390| 68 61 6e 2c 20 28 75 6e | 73 69 67 6e 65 64 20 6c |han, (un|signed l|
|000003a0| 6f 6e 67 29 74 68 65 57 | 61 76 65 2c 20 28 50 72 |ong)theW|ave, (Pr|
|000003b0| 6f 63 50 74 72 29 57 61 | 76 65 52 65 61 64 50 72 |ocPtr)Wa|veReadPr|
|000003c0| 6f 63 2c 20 28 50 72 6f | 63 50 74 72 29 6e 69 6c |oc, (Pro|cPtr)nil|
|000003d0| 2c 0d 09 09 09 09 09 09 | 09 26 74 68 65 48 65 61 |,.......|.&theHea|
|000003e0| 64 65 72 2c 20 64 75 72 | 72 61 74 69 6f 6e 2c 20 |der, dur|ration, |
|000003f0| 6e 69 6c 2c 20 70 72 69 | 76 61 74 65 44 61 74 61 |nil, pri|vateData|
|00000400| 29 3b 0d 7d 09 0d 09 0d | 2f 2f 7e 7e 7e 7e 7e 7e |);.}....|//~~~~~~|
|00000410| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000420| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000430| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000440| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000450| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 0d 2f 2f 20 72 65 |~~~~~~~~|~~.// re|
|00000460| 61 64 20 70 72 6f 63 65 | 64 75 72 65 20 66 6f 72 |ad proce|dure for|
|00000470| 20 72 65 74 72 69 65 76 | 69 6e 67 20 73 6f 75 6e | retriev|ing soun|
|00000480| 64 20 64 61 74 61 20 66 | 72 6f 6d 20 74 68 65 20 |d data f|rom the |
|00000490| 77 61 76 65 20 73 70 65 | 63 0d 4f 53 45 72 72 20 |wave spe|c.OSErr |
|000004a0| 57 61 76 65 52 65 61 64 | 50 72 6f 63 20 28 76 6f |WaveRead|Proc (vo|
|000004b0| 69 64 20 2a 70 72 69 76 | 61 74 65 2c 20 73 68 6f |id *priv|ate, sho|
|000004c0| 72 74 20 62 75 66 4e 75 | 6d 2c 20 42 6f 6f 6c 65 |rt bufNu|m, Boole|
|000004d0| 61 6e 20 61 73 79 6e 63 | 68 29 0d 7b 0d 09 4f 53 |an async|h).{..OS|
|000004e0| 45 72 72 20 09 09 09 09 | 09 09 09 65 72 72 20 09 |Err ....|...err .|
|000004f0| 09 09 09 09 09 3d 20 6e | 6f 45 72 72 3b 0d 09 6c |.....= n|oErr;..l|
|00000500| 6f 6e 67 09 09 09 09 09 | 09 09 6f 6c 64 41 35 09 |ong.....|..oldA5.|
|00000510| 09 09 09 09 09 3d 20 6e | 69 6c 3b 0d 09 6c 6f 6e |.....= n|il;..lon|
|00000520| 67 09 09 09 09 09 09 09 | 72 64 53 69 7a 65 09 09 |g.......|rdSize..|
|00000530| 09 09 09 09 3d 20 30 3b | 0d 09 72 65 67 69 73 74 |....= 0;|..regist|
|00000540| 65 72 20 73 74 72 69 70 | 70 65 64 44 6f 77 6e 52 |er strip|pedDownR|
|00000550| 65 61 64 50 42 50 74 72 | 09 70 62 09 09 09 09 09 |eadPBPtr|.pb.....|
|00000560| 09 09 3d 20 6e 69 6c 3b | 0d 09 50 72 69 76 61 74 |..= nil;|..Privat|
|00000570| 65 44 42 49 6e 66 6f 50 | 74 72 09 09 09 09 64 62 |eDBInfoP|tr....db|
|00000580| 49 6e 66 6f 3b 0d 0d 09 | 64 62 49 6e 66 6f 20 3d |Info;...|dbInfo =|
|00000590| 20 28 50 72 69 76 61 74 | 65 44 42 49 6e 66 6f 50 | (Privat|eDBInfoP|
|000005a0| 74 72 29 20 70 72 69 76 | 61 74 65 3b 0d 0d 09 69 |tr) priv|ate;...i|
|000005b0| 66 20 28 64 62 49 6e 66 | 6f 2d 3e 62 79 74 65 73 |f (dbInf|o->bytes|
|000005c0| 54 6f 47 6f 20 3d 3d 20 | 30 29 09 09 09 09 09 09 |ToGo == |0)......|
|000005d0| 09 09 09 09 09 09 2f 2f | 20 4e 6f 20 42 79 74 65 |......//| No Byte|
|000005e0| 73 20 74 6f 20 72 65 61 | 64 3f 20 62 61 69 6c 0d |s to rea|d? bail.|
|000005f0| 09 09 65 72 72 20 3d 20 | 65 6f 66 45 72 72 3b 0d |..err = |eofErr;.|
|00000600| 09 65 6c 73 65 20 7b 0d | 0d 09 09 2f 2f 09 41 67 |.else {.|...//.Ag|
|00000610| 61 69 6e 2c 20 6f 70 74 | 69 6d 69 7a 69 6e 67 20 |ain, opt|imizing |
|00000620| 6f 75 74 20 73 6f 6d 65 | 20 6f 66 20 74 68 65 73 |out some| of thes|
|00000630| 65 20 64 65 2d 72 65 66 | 65 72 65 6e 63 65 73 0d |e de-ref|erences.|
|00000640| 09 09 70 62 20 3d 20 26 | 28 64 62 49 6e 66 6f 2d |..pb = &|(dbInfo-|
|00000650| 3e 62 75 66 66 65 72 73 | 5b 62 75 66 4e 75 6d 5d |>buffers|[bufNum]|
|00000660| 2e 72 65 61 64 50 42 2e | 70 62 29 3b 0d 09 0d 09 |.readPB.|pb);....|
|00000670| 09 69 66 20 28 64 62 49 | 6e 66 6f 2d 3e 62 79 74 |.if (dbI|nfo->byt|
|00000680| 65 73 54 6f 47 6f 20 3e | 20 6b 42 75 66 66 65 72 |esToGo >| kBuffer|
|00000690| 53 69 7a 65 29 0d 09 09 | 09 72 64 53 69 7a 65 20 |Size)...|.rdSize |
|000006a0| 3d 20 6b 42 75 66 66 65 | 72 53 69 7a 65 3b 0d 09 |= kBuffe|rSize;..|
|000006b0| 09 65 6c 73 65 0d 09 09 | 09 72 64 53 69 7a 65 20 |.else...|.rdSize |
|000006c0| 3d 20 64 62 49 6e 66 6f | 2d 3e 62 79 74 65 73 54 |= dbInfo|->bytesT|
|000006d0| 6f 47 6f 3b 0d 09 0d 09 | 09 70 62 2d 3e 69 6f 46 |oGo;....|.pb->ioF|
|000006e0| 52 65 66 4e 75 6d 20 3d | 20 64 62 49 6e 66 6f 2d |RefNum =| dbInfo-|
|000006f0| 3e 72 65 66 4e 75 6d 3b | 09 09 09 09 09 09 09 09 |>refNum;|........|
|00000700| 09 09 2f 2f 20 73 65 74 | 20 75 70 20 74 68 65 20 |..// set| up the |
|00000710| 70 61 72 61 6d 42 6c 6f | 63 6b 0d 09 09 70 62 2d |paramBlo|ck...pb-|
|00000720| 3e 69 6f 42 75 66 66 65 | 72 20 3d 20 64 62 49 6e |>ioBuffe|r = dbIn|
|00000730| 66 6f 2d 3e 62 75 66 66 | 65 72 73 5b 62 75 66 4e |fo->buff|ers[bufN|
|00000740| 75 6d 5d 2e 68 65 61 64 | 65 72 2d 3e 73 61 6d 70 |um].head|er->samp|
|00000750| 6c 65 50 74 72 3b 0d 09 | 09 70 62 2d 3e 69 6f 52 |lePtr;..|.pb->ioR|
|00000760| 65 71 43 6f 75 6e 74 20 | 3d 20 72 64 53 69 7a 65 |eqCount |= rdSize|
|00000770| 3b 0d 09 09 70 62 2d 3e | 69 6f 50 6f 73 4d 6f 64 |;...pb->|ioPosMod|
|00000780| 65 20 3d 20 66 73 41 74 | 4d 61 72 6b 3b 0d 09 09 |e = fsAt|Mark;...|
|00000790| 70 62 2d 3e 69 6f 50 6f | 73 4f 66 66 73 65 74 20 |pb->ioPo|sOffset |
|000007a0| 3d 30 3b 0d 09 09 64 62 | 49 6e 66 6f 2d 3e 62 75 |=0;...db|Info->bu|
|000007b0| 66 66 65 72 73 5b 62 75 | 66 4e 75 6d 5d 2e 72 65 |ffers[bu|fNum].re|
|000007c0| 61 64 50 42 2e 75 73 65 | 72 49 6e 66 6f 20 3d 20 |adPB.use|rInfo = |
|000007d0| 28 50 74 72 29 64 62 49 | 6e 66 6f 3b 0d 09 09 64 |(Ptr)dbI|nfo;...d|
|000007e0| 62 49 6e 66 6f 2d 3e 62 | 75 66 66 65 72 73 5b 62 |bInfo->b|uffers[b|
|000007f0| 75 66 4e 75 6d 5d 2e 72 | 65 61 64 50 42 2e 68 65 |ufNum].r|eadPB.he|
|00000800| 61 64 65 72 4e 75 6d 20 | 3d 20 62 75 66 4e 75 6d |aderNum |= bufNum|
|00000810| 3b 0d 0d 09 09 52 65 61 | 64 57 61 76 65 20 28 28 |;....Rea|dWave ((|
|00000820| 57 61 76 65 43 79 63 6c | 65 50 74 72 29 20 64 62 |WaveCycl|ePtr) db|
|00000830| 49 6e 66 6f 2d 3e 72 65 | 66 4e 75 6d 2c 20 72 64 |Info->re|fNum, rd|
|00000840| 53 69 7a 65 2c 20 70 62 | 2d 3e 69 6f 42 75 66 66 |Size, pb|->ioBuff|
|00000850| 65 72 29 3b 09 09 2f 2f | 20 47 65 74 20 74 68 65 |er);..//| Get the|
|00000860| 20 44 61 74 61 20 0d 09 | 0d 09 09 69 66 20 28 61 | Data ..|...if (a|
|00000870| 73 79 6e 63 68 29 20 7b | 0d 09 09 09 70 62 2d 3e |synch) {|....pb->|
|00000880| 69 6f 43 6f 6d 70 6c 65 | 74 69 6f 6e 20 3d 20 28 |ioComple|tion = (|
|00000890| 50 72 6f 63 50 74 72 29 | 26 43 6f 6d 70 6c 65 74 |ProcPtr)|&Complet|
|000008a0| 65 52 65 61 64 3b 09 09 | 09 09 09 09 2f 2f 20 54 |eRead;..|....// T|
|000008b0| 68 69 73 20 69 73 20 61 | 20 66 6f 72 6d 61 6c 69 |his is a| formali|
|000008c0| 74 79 0d 09 09 09 70 75 | 74 50 42 20 28 70 62 29 |ty....pu|tPB (pb)|
|000008d0| 3b 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 2f |;.......|......./|
|000008e0| 2f 20 53 74 75 66 66 20 | 50 42 20 6f 6e 20 28 41 |/ Stuff |PB on (A|
|000008f0| 30 29 0d 09 09 09 43 6f | 6d 70 6c 65 74 65 52 65 |0)....Co|mpleteRe|
|00000900| 61 64 20 28 29 3b 0d 09 | 09 7d 20 65 6c 73 65 0d |ad ();..|.} else.|
|00000910| 09 09 09 70 62 2d 3e 69 | 6f 43 6f 6d 70 6c 65 74 |...pb->i|oComplet|
|00000920| 69 6f 6e 20 3d 20 6e 69 | 6c 3b 0d 09 09 0d 09 09 |ion = ni|l;......|
|00000930| 64 62 49 6e 66 6f 2d 3e | 62 79 74 65 73 54 6f 47 |dbInfo->|bytesToG|
|00000940| 6f 20 2d 3d 20 72 64 53 | 69 7a 65 3b 0d 09 0d 09 |o -= rdS|ize;....|
|00000950| 09 64 62 49 6e 66 6f 2d | 3e 62 75 66 66 65 72 73 |.dbInfo-|>buffers|
|00000960| 5b 62 75 66 4e 75 6d 5d | 2e 68 65 61 64 65 72 2d |[bufNum]|.header-|
|00000970| 3e 6c 65 6e 67 74 68 20 | 3d 20 20 72 64 53 69 7a |>length |= rdSiz|
|00000980| 65 3b 0d 0d 09 09 2f 2f | 09 69 66 20 77 65 20 77 |e;....//|.if we w|
|00000990| 65 72 65 20 63 61 6c 6c | 65 64 20 73 79 6e 63 68 |ere call|ed synch|
|000009a0| 72 6f 6e 6f 75 73 6c 79 | 2c 20 63 68 61 6e 63 65 |ronously|, chance|
|000009b0| 73 20 61 72 65 20 77 65 | 20 63 61 72 65 20 61 62 |s are we| care ab|
|000009c0| 6f 75 74 20 74 68 65 20 | 77 68 65 6e 20 77 65 20 |out the |when we |
|000009d0| 68 69 74 20 74 68 65 0d | 09 09 2f 2f 09 20 22 45 |hit the.|..//. "E|
|000009e0| 6e 64 20 6f 66 20 46 69 | 6c 65 22 2c 20 73 6f 20 |nd of Fi|le", so |
|000009f0| 69 66 20 72 64 53 69 7a | 65 20 69 73 20 6c 65 73 |if rdSiz|e is les|
|00000a00| 73 20 74 68 61 6e 20 74 | 68 65 20 62 75 66 66 65 |s than t|he buffe|
|00000a10| 72 73 69 7a 65 20 77 65 | 20 6b 6e 6f 77 20 74 68 |rsize we| know th|
|00000a20| 69 73 20 77 61 73 20 74 | 68 65 0d 09 09 2f 2f 09 |is was t|he...//.|
|00000a30| 20 6c 61 73 74 20 62 75 | 66 66 65 72 20 72 65 61 | last bu|ffer rea|
|00000a40| 64 2e 2e 2e 0d 09 09 69 | 66 20 28 72 64 53 69 7a |d......i|f (rdSiz|
|00000a50| 65 20 3c 20 6b 42 75 66 | 66 65 72 53 69 7a 65 29 |e < kBuf|ferSize)|
|00000a60| 0d 09 09 09 65 72 72 20 | 3d 20 65 6f 66 45 72 72 |....err |= eofErr|
|00000a70| 3b 0d 09 09 09 0d 09 7d | 0d 09 72 65 74 75 72 6e |;......}|..return|
|00000a80| 20 28 65 72 72 29 3b 0d | 7d 0d 0d 2f 2f 7e 7e 7e | (err);.|}..//~~~|
|00000a90| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000aa0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000ab0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000ac0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000ad0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 0d 2f 2f |~~~~~~~~|~~~~~.//|
|00000ae0| 09 52 65 61 64 57 61 76 | 65 20 6d 61 6b 65 73 20 |.ReadWav|e makes |
|00000af0| 61 20 77 61 76 65 20 73 | 6e 69 70 70 65 74 20 6c |a wave s|nippet l|
|00000b00| 6f 6f 6b 20 6c 69 6b 65 | 20 61 20 63 6f 6e 74 69 |ook like| a conti|
|00000b10| 6e 75 6f 75 73 20 77 61 | 76 65 20 66 6f 72 6d 20 |nuous wa|ve form |
|00000b20| 74 6f 20 74 68 65 20 63 | 61 6c 6c 65 72 0d 76 6f |to the c|aller.vo|
|00000b30| 69 64 20 52 65 61 64 57 | 61 76 65 20 28 57 61 76 |id ReadW|ave (Wav|
|00000b40| 65 43 79 63 6c 65 50 74 | 72 20 74 68 65 57 61 76 |eCyclePt|r theWav|
|00000b50| 65 2c 20 75 6e 73 69 67 | 6e 65 64 20 73 68 6f 72 |e, unsig|ned shor|
|00000b60| 74 20 72 65 71 42 79 74 | 65 73 2c 20 50 74 72 20 |t reqByt|es, Ptr |
|00000b70| 62 75 66 66 65 72 29 0d | 7b 0d 09 73 74 61 74 69 |buffer).|{..stati|
|00000b80| 63 20 75 6e 73 69 67 6e | 65 64 20 73 68 6f 72 74 |c unsign|ed short|
|00000b90| 09 6d 61 72 6b 20 09 09 | 09 09 3d 20 30 3b 0d 09 |.mark ..|..= 0;..|
|00000ba0| 75 6e 73 69 67 6e 65 64 | 20 73 68 6f 72 74 09 09 |unsigned| short..|
|00000bb0| 09 78 66 65 72 53 69 7a | 65 09 09 09 3d 20 30 3b |.xferSiz|e...= 0;|
|00000bc0| 0d 09 0d 09 77 68 69 6c | 65 20 28 72 65 71 42 79 |....whil|e (reqBy|
|00000bd0| 74 65 73 20 3e 20 30 29 | 20 7b 0d 0d 09 09 2f 2f |tes > 0)| {....//|
|00000be0| 09 46 69 67 75 72 65 20 | 6f 75 74 20 68 6f 77 20 |.Figure |out how |
|00000bf0| 6d 61 6e 79 20 62 79 74 | 65 73 20 74 6f 20 74 68 |many byt|es to th|
|00000c00| 65 20 65 6e 64 20 6f 66 | 20 74 68 65 20 77 61 76 |e end of| the wav|
|00000c10| 65 0d 09 09 78 66 65 72 | 53 69 7a 65 20 3d 20 28 |e...xfer|Size = (|
|00000c20| 74 68 65 57 61 76 65 2d | 3e 6c 65 6e 67 74 68 20 |theWave-|>length |
|00000c30| 2d 20 6d 61 72 6b 29 3b | 0d 09 09 0d 09 09 2f 2f |- mark);|......//|
|00000c40| 09 4d 61 6b 65 20 73 75 | 72 65 20 77 65 27 72 65 |.Make su|re we're|
|00000c50| 20 22 72 65 61 64 69 6e | 67 22 20 74 68 65 20 61 | "readin|g" the a|
|00000c60| 70 70 72 6f 70 72 69 61 | 74 65 20 6e 75 6d 62 65 |ppropria|te numbe|
|00000c70| 72 20 6f 66 20 62 79 74 | 65 73 0d 09 09 69 66 20 |r of byt|es...if |
|00000c80| 28 72 65 71 42 79 74 65 | 73 20 3c 20 78 66 65 72 |(reqByte|s < xfer|
|00000c90| 53 69 7a 65 29 20 0d 09 | 09 09 78 66 65 72 53 69 |Size) ..|..xferSi|
|00000ca0| 7a 65 20 3d 20 72 65 71 | 42 79 74 65 73 3b 0d 09 |ze = req|Bytes;..|
|00000cb0| 09 09 0d 09 09 42 6c 6f | 63 6b 4d 6f 76 65 20 28 |.....Blo|ckMove (|
|00000cc0| 28 74 68 65 57 61 76 65 | 2d 3e 77 61 76 65 50 74 |(theWave|->wavePt|
|00000cd0| 72 20 2b 20 6d 61 72 6b | 29 2c 20 62 75 66 66 65 |r + mark|), buffe|
|00000ce0| 72 2c 20 78 66 65 72 53 | 69 7a 65 29 3b 0d 09 09 |r, xferS|ize);...|
|00000cf0| 0d 09 09 62 75 66 66 65 | 72 20 2b 3d 20 78 66 65 |...buffe|r += xfe|
|00000d00| 72 53 69 7a 65 3b 0d 09 | 09 72 65 71 42 79 74 65 |rSize;..|.reqByte|
|00000d10| 73 20 2d 3d 20 78 66 65 | 72 53 69 7a 65 3b 0d 09 |s -= xfe|rSize;..|
|00000d20| 09 0d 09 09 6d 61 72 6b | 20 2b 3d 20 78 66 65 72 |....mark| += xfer|
|00000d30| 53 69 7a 65 3b 0d 09 09 | 69 66 20 28 6d 61 72 6b |Size;...|if (mark|
|00000d40| 20 3e 3d 20 74 68 65 57 | 61 76 65 2d 3e 6c 65 6e | >= theW|ave->len|
|00000d50| 67 74 68 29 0d 09 09 09 | 6d 61 72 6b 20 3d 20 30 |gth)....|mark = 0|
|00000d60| 3b 0d 09 7d 0d 7d 0d 00 | 00 00 00 00 00 00 00 00 |;..}.}..|........|
|00000d70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d80| 00 00 01 00 00 00 01 6e | 00 00 00 6e 00 00 00 3e |.......n|...n...>|
|00000d90| 02 64 01 6d 00 00 00 08 | 20 6d d9 6e a0 64 00 08 |.d.m....| m.n.d..|
|00000da0| 9d b2 00 00 00 00 00 08 | 9a 4c 00 08 9d ee 65 66 |........|.L....ef|
|00000db0| 0f 50 6c 61 79 46 72 6f | 6d 53 79 6e 74 68 2e 63 |.PlayFro|mSynth.c|
|00000dc0| 02 00 00 00 54 45 58 54 | 4d 50 53 20 01 00 ff ff |....TEXT|MPS ....|
|00000dd0| 00 00 54 45 58 54 4d 50 | 53 20 01 00 ff ff ff ff |..TEXTMP|S ......|
|00000de0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000df0| 00 00 a6 07 24 b2 00 00 | 0c e7 00 00 01 ac 67 12 |....$...|......g.|
|00000e00| 00 08 9e 14 00 00 00 00 | 00 08 9a 4c 00 08 9e 4a |........|...L...J|
|00000e10| 00 0c 4a ae 00 0c 67 1a | 02 2d 01 76 00 00 00 40 |..J...g.|.-.v...@|
|00000e20| fa 38 2f 2d d9 76 0e 73 | 74 61 74 65 42 6c 6f 63 |.8/-.v.s|tateBloc|
|00000e30| 6b 53 69 7a 65 65 00 00 | 00 00 0c 32 48 6d 00 1f |kSizee..|...2Hm..|
|00000e40| a8 fa 4e ad 0c 32 00 00 | 00 40 00 00 00 40 02 f8 |..N..2..|.@...@..|
|00000e50| 01 5e 00 00 00 40 65 66 | 69 6e 65 56 00 08 9e 70 |.^...@ef|ineV...p|
|00000e60| 00 00 00 00 00 08 9a 4c | 00 08 9e a8 00 0c 48 6d |.......L|......Hm|
|00000e70| ea 2e 2f 0c 02 ad 01 82 | 00 00 00 20 00 08 4e ba |../.....|... ..N.|
|00000e80| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 66 72 6f |...H..Mo|naco.fro|
|00000e90| 6d 2d 57 61 76 65 20 74 | 79 70 65 20 6f 70 65 72 |m-Wave t|ype oper|
|00000ea0| 61 74 69 6f 6e 73 00 06 | 00 04 00 2a 00 02 03 3e |ations..|...*...>|
|00000eb0| 02 8f 00 2a 00 02 03 3e | 02 8f a6 6f a5 ed 00 00 |...*...>|...o....|
|00000ec0| 03 80 00 00 03 80 00 00 | 01 0e 01 00 00 00 00 1e |........|........|
|00000ed0| 00 2a 00 02 03 3e 02 8f | 00 2a 00 02 03 3e 02 8f |.*...>..|.*...>..|
|00000ee0| 00 00 01 0e 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ef0| 01 00 00 00 01 6e 00 00 | 00 6e 00 00 00 3e 00 8e |.....n..|.n...>..|
|00000f00| 1e 5c 08 74 00 00 00 1c | 00 3e 00 00 4d 50 53 52 |.\.t....|.>..MPSR|
|00000f10| 00 01 00 0a 03 ed ff ff | 00 00 00 00 00 00 00 00 |........|........|
|00000f20| 03 f0 ff ff 00 00 00 4c | 00 94 1c c8 00 00 00 00 |.......L|........|
|00000f30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+